﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using KVB.Common;
using Customer_Profile.eCard.DBDao;
using Customer_Profile.Admin;

namespace Customer_Profile.eCard.Settle
{
    public partial class PayList : System.Web.UI.Page
    {
        string strUserName = "";
        string strUserID = "";
        string strEntity = "";
        protected void Page_Load(object sender, EventArgs e)
        {
            Comm.CheckSession(this.Page, "/login.aspx", "usermodel");
            if (Session["usermodel"] != null)
            {
                strUserID = ((UserInfoEntity)Session["usermodel"]).UserLoginId;
                strUserName = ((UserInfoEntity)Session["usermodel"]).UserName;
                strEntity = ((UserInfoEntity)Session["usermodel"]).UserOffice;
            }
            else
            {
                Log.WriteDefaultLog("main_01 Page_Load", "Session is null");
                return;
            }
            string strURL = HttpContext.Current.Request.Url.AbsolutePath;
            bool bok = Comm.ifhasright(strUserID, strURL);
            if (!bok)
            {
                Response.Write("你无权访问此页面");
                Response.End();
            }

            if (!Page.IsPostBack)
            {
                Comm.BindDll(ref dropStatus, "SettleTransferStatus", false, "");
                BindgridTransfer();
            }
           
        }

        private void BindgridTransfer()
        {
            try
            {
                DataSet ds = null;
                string strStatus = dropStatus.SelectedItem.Value;
                ds = DealDao.getSettleTransferList(strStatus);
                gridSettleTransfer.DataSource = ds;
                gridSettleTransfer.DataBind();
                gridSettleTransfer.FocusedRowIndex = -1;
                gridSettleTransfer.FocusedRowIndex = 0;
            }
            catch (Exception ex)
            {
                Log.WriteDefaultLog("PayList_BindgridTransfer",ex.ToString());
                Response.Write(ex.ToString());
            }
        }

        protected void dropStatus_SelectedIndexChanged(object sender, EventArgs e)
        {
            BindgridTransfer();
        }
    }
}